The HealthHeartbeatSeriesSample
class provides an interface for accessing heartbeat series samples, representing a series of individual heartbeat intervals recorded over time. These samples are typically used for analyzing heart rhythm and detecting irregularities such as atrial fibrillation.
This class is returned by the public API method Health.queryHeartbeatSeriesSamples()
.
HealthHeartbeatSeriesSample
Property | Type | Description |
---|---|---|
uuid |
string |
A unique identifier for the sample |
sampleType |
string |
The type of the sample. Typically "HKHeartbeatSeriesTypeIdentifier" |
startDate |
Date |
When the heartbeat series recording began |
endDate |
Date |
When the recording ended |
count |
number |
Total number of heartbeat intervals in the series |
metadata |
Record<string, any> | null |
Optional metadata including device info or annotations |
Note: This class currently does not expose individual RR intervals. It represents only the series summary.
Health.queryHeartbeatSeriesSamples(options?)
startDate
(optional): Only return samples on or after this date.endDate
(optional): Only return samples on or before this date.limit
(optional): Maximum number of samples to return.strictStartDate
(optional): If true, only include samples whose startDate
equals startDate
.strictEndDate
(optional): If true, only include samples whose endDate
equals endDate
.sortDescriptors
(optional): Sort results by startDate
, endDate
, or count
, in forward or reverse order.requestPermissions
(optional): An array of health quantity types for which to request permissions before querying. You must request permissions for the types you want to query. Default only requests permissions for the heartbeat
, heartRateVariabilitySDNN
and heartRate
types.A Promise resolving to an array of HealthHeartbeatSeriesSample
instances, sorted according to the provided descriptors.